#include "AudioManager.h"
#include "BaseGame.h"
AudioManager* g_pAudioManager = 0;
AudioManager::AudioManager(void)
{
	g_pAudioManager = this;
}


AudioManager::~AudioManager(void)
{
}

bool AudioManager::Initialize()
{
	m_effectMap["workshop"] = g_pHge->Effect_Load("Content/Audio/workshop.wav"); 
	m_effectMap["die"] = g_pHge->Effect_Load("Content/Audio/die1.wav"); 
	m_effectMap["die2"] = g_pHge->Effect_Load("Content/Audio/die2.wav"); 
	m_effectMap["cash"] = g_pHge->Effect_Load("Content/Audio/cash.wav"); 
	m_effectMap["rainDie"] = g_pHge->Effect_Load("Content/Audio/rainDie.wav"); 
	m_effectMap["yay"] = g_pHge->Effect_Load("Content/Audio/yay.wav"); 
	m_effectMap["bubble"] = g_pHge->Effect_Load("Content/Audio/bubble.wav"); 
	m_effectMap["huh1"] = g_pHge->Effect_Load("Content/Audio/huh1.wav"); 
	m_effectMap["huh2"] = g_pHge->Effect_Load("Content/Audio/huh2.wav"); 
	m_effectMap["march"] = g_pHge->Effect_Load("Content/Audio/march.wav"); 
	m_effectMap["boing"] = g_pHge->Effect_Load("Content/Audio/boing.wav"); 



	m_songMap["xmas"] = g_pHge->Music_Load("Content/Audio/xmas.xm");
	return true;
}

void AudioManager::PlayEffect(string effect)
{
	mapIterator = m_effectMap.end();

	if((mapIterator = m_effectMap.find(effect)) != m_effectMap.end())
		g_pHge->Effect_Play( (*mapIterator).second );

}

void AudioManager::PlaySong(string song, bool looped)
{

	mapIterator = m_songMap.end();

	if((mapIterator = m_songMap.find(song)) != m_songMap.end())
		m_channelMap[song] = g_pHge->Music_Play( (*mapIterator).second, looped );
}

void AudioManager::StopSong(string song)
{
	mapIterator = m_channelMap.end();

	if((mapIterator = m_channelMap.find(song)) != m_channelMap.end())
		g_pHge->Channel_Stop( (*mapIterator).second );

}